package com.dbxt.util;

public class FileUploadUtil {
	//校验文件格式
	public static boolean  CheckFile(String filename) {
		String [] name= {"doc","DOC","docx","DOCX"};
		for (String string : name) {
			if(filename.contains(string)) {
				return true;
			}
		}
		return false;
	}
	public static String getFileNameEnds(String fileFullName) {
		int lastIdx = fileFullName.lastIndexOf(".");
		if (lastIdx < 1) {
			return "";
		} else {
			return fileFullName.substring(lastIdx);
		}
	}
	public static boolean  CheckImages(String filename) {
	String [] name= {"jpg","JPG","PNG","png","jpeg","JPEG"};
		for (String string : name) {
			if(filename.contains(string)){
				return true;
			}	
		}
			return false;
	}
	public static boolean uploadProject(String filename) {
	String [] name= {"rar","RAR","zip","ZIP"};
		for (String string : name) {
			if(filename.contains(string)){
				return true;
			}	
		}
				return false;
	}
}
